package com;

import com.example.demo.service.TestJediLockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.concurrent.*;

@SpringBootApplication
@EnableScheduling
public class DemoApplication implements CommandLineRunner {
    public static ExecutorService executorService = new ThreadPoolExecutor(10, 100, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(300));

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }


    @Autowired
    private TestJediLockService service;

    @Override
    public void run(String... strings) throws Exception {

//        for (int i = 0; i <= 100; i++) {
//            executorService.submit(new Runnable() {
//                @Override
//                public void run() {
//                    while (true) {
//                        service.executeTest();
//                    }
//                }
//            });
//        }
    }

}
